
import {http} from "@/utils/http";

// 获取项目列表
export const getCommonMaterialsListAPI=(cur,pageSize)=>{
    return http.get('/commonMaterials/list',{
        params:{
            cur,
            pageSize
        }
    })
}

// 获取项目数量
export const getCommonMaterialsCountAPI=()=>{
    return http.get('/commonMaterials/allCount')
}

// 根据id查询
export const getCommonMaterialsInfoAPI=(id)=>{
    return http({
        method:'GET',
        url:`/commonMaterials/getInfo/${id}`,
        params:{
            id
        }
    })
}

// 新增
export const addOneCommonMaterialsAPI=(oneCommonMaterials)=>{
    return http.post('/commonMaterials/save',oneCommonMaterials)
}

// 删除
export const deleteOneCommonMaterialsAPI=(id)=>{
    return http.delete(`/commonMaterials/remove/${id}`,{
        params:{
            id
        }
    })
}

// 修改
export const updateOneCommonMaterialsAPI=(oneCommonMaterials)=>{
    return http.put('/commonMaterials/update',oneCommonMaterials)
}



// 根据项目名称查询项目数量
export function getCommonMaterialsCountByNameAPI(name){
    return http({
        method:'GET',
        url:`/commonMaterials/getByNameCount`,
        params:{
            name
        }
    })
}


// 根据项目名称查询项目
export function getCommonMaterialsListByNameAPI(name,cur,pageSize){
    return http({
        method:'GET',
        url:`/commonMaterials/getByName`,
        params:{
            name,
            cur,
            pageSize
        }
    })
}

